﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Pathology.UI;
using PathologyDAL.Modle;
using PathologyDAL.Service;
using Sunny.UI;

namespace Pathology.Control
{
    public partial class ConditionDisPlay : UIUserControl
    {
        public ConditionDisPlay()
        {
            InitializeComponent();
        }

        private TumourConditionDisPlay filterCondition;

      

        public ConditionDisPlay(TumourConditionDisPlay filter)
        {
            InitializeComponent();
            filterCondition = filter;

            
        }

        private void ConditionDisPlay_Load(object sender, EventArgs e)
        {
            LoadDisplay();
        }

        private void LoadDisplay()
        {
            if (null == filterCondition)
            {
                return;
            }
            uiGroupBoxName.Text = AttributeValueTool.GetDisplayLable<Filter>(
                filterCondition.FilterConditionInfo.Filter.ToString()
            );
            uiLabelNameDisPlay.Text = filterCondition.FilterConditionInfo   .Name;
             
            uiLabelPossible.Text = AttributeValueTool.GetNikeName<Possibility>(
                filterCondition.TumourCondition.Possibility.ToString()
            );
        }

        private void uiLabelPossible_DoubleClick(object sender, EventArgs e)
        {
            //


            RefreshFilterCondition refreshFilterCondition = new RefreshFilterCondition(
              
                filterCondition,
                (f, d) =>
                {
                    if (d)
                    {
                        uiLabelPossible.Text = "已删除";
                        return;
                    }
                    filterCondition = f;

                    LoadDisplay();
                }
            );
            refreshFilterCondition.ShowDialog();
        }
    }
}
